On this page:
Above is the view of table Windows in sample Database, store attribute data of all blocks "Window" in sample drawing.
Once "Window" blocks are edited, or deleted, after drawing is saved, Database will be updated automatically.
Deleted block record will be marked with handle = -1 (as seen in above image)
New record will be create for each newly inserted block.
Let's look further in the design of Windows table:
All required columns (fields) should be added when creating table, at table design session. Otherwise, ACAD_db will mark as an error if it can not find a column.
Beside Windows table, we can create Doors table to store "Door" blocks's attribute data, Furniture table to store "Chair", "Desk" etc. blocks's attribute data. They are custom table. But below the surface, there are mandatory tables we have to build in each Database. This will be explained in the next section.
ACAD_db supports multiple data source / table for a single drawing.
A master database (defined in AcDbSettings command) which has all mandatory tables.
Multiple other database (each one is defined by a Data Link udl file) to store attribute values.
Note: It is suggested to store all attribute values of a block in a single table.
In the image to the left, you can see in master database, there is Windows table to store Window blocks data. Below is "Other Database" database, which has Doors table to store Doors block data.
You can edit these tables data directly within AutoCAD from dbConnect Manager palette.
Following are steps to create them:
Open your Database and make 3 tables JTBW_Files, JTBW_SyncDir and JTBW_AttSync.
You can copy these tables from sample database.
JTBW_AttSync table
This table stores attribute - database link. Each record (row) is a link definition with following fields:
DBConnection defines where attribute data to store. DBConnection has the following syntax:
[Data Source Name (Data Link udl filename)]![Database Table]![Database Field (or column)].
From version 4.0, a Setup Window for JTBW_AttSync is created to ease the tasks. Here are the screenshots:
Advance Edit Row:
Table that hold attribute data
The name of these tables is up to the user but needs to be specified in the DBConnection field in JTBW_AttSync table.
The following three fields needs to be added
ParentBlockName and ParentBlockHandle are automatically added fields.
The other fields are free to specify but the field type must match the value that the attribute can hold. There can be extra fields besides the fields that are linked. Make sure to not use names that are reserved as SQL words like in these examples: http://msdn.microsoft.com/en-us/library/aa238507(v=sql.80).aspx
Run AcDbSettings command to choose "master" Data Link udl for your drawing. Save your drawing.
User needs to test whether specified new data source is available or not using button "Validate". If data source is not available a message box will be displayed to user. To set data source name in dialog box, data source with specified name must be available.
Note if the checkbox "Sync attributes" is checked any changes done in the drawing while the DLL was not loaded will be replace from the database when the drawing is opened with the DLL loaded. So if you have scenarios where users need to update attributes without the DLL loaded uncheck this option.
Click "OK and Edit JTBW_AttSync". The "JTBW Acad Db AttSync Setup" window will bring up for you to edit the JTBW_AttSync table.
Command -AcDbSettings allows user to change ACAD_db settings through command line.
Run AcDbOut to populate attribute data to Database. Try edit your attribute data and save drawing. You will find Database will be automatically updated.
Final result will be as described in top section of this page
Visit our webpage for more information: https://jtbworld.com/acad-db
For support email us at info@jtbworld.com